# -*- coding: utf-8 -*-
from flask import Flask
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
import os


app = Flask( __name__ )

manager = Manager( app )

app.config.from_pyfile( "config/base_setting.py" )
#ops_config=local|production
#linux export ops_config=local|production
#windows set ops_config=local|production
if "ops_config" in os.environ:
    app.config.from_pyfile( "config/%s_setting.py"%( os.environ['ops_config'] ) )


db = SQLAlchemy( app )

@app.template_filter('showtime')
def showtime(time):
    time1 = str(time)
    time2 = time1[11:16]
    return time2


@app.template_filter('showweek')
def showweek(num):
    if num == 1 :
       return "星期一"
    if num == 2:
        return "星期二"
    if num == 3:
        return "星期三"
    if num == 4:
        return "星期四"
    if num == 5:
        return "星期五"
    if num == 6:
        return "星期六"
    if num == 7:
        return "星期日"

@app.template_filter('deletenone')
def deletenone(a):
    if a==None or a =="":
        return "空"
    else:
        return a

@app.template_filter('tolist')
def tolist(company):
    companylist = company.split(',')
    return companylist






